<template>
  <DIV class="bg_write" v-loading="loading">
    <el-col :span="24" class="content_title clearfix">
      <el-col :span="12">
        <HeadTitle></HeadTitle>
      </el-col>
    </el-col>
    <div class="blank"></div>
    <div class="user_info">
      <h3 style="margin-bottom:10px">基本信息</h3>
      <div class="info">
        <ul>
          <li>
            <span>创建人账号:</span>
            {{ data.username }}
          </li>
          <li>
            <span>创建人昵称:</span>
            {{ data.nickname }}
          </li>
          <li>
            <span>口号:</span>
            {{ data.team_slogan }}
          </li>
        </ul>
      </div>
    </div>
    <div class="blank" style="height:20px"></div>

    <div>
      <tableComponents :pagination="{ currentPage, pageSize, total: list.all_num }" @handleCurrentChange="handleCurrentChange"
          @handleSizeChange="handleSizeChange" :isShow="false" :isHaveExport="false" :isHaveAdd="false">
        <template v-slot:table>
          <el-table ref="multipleTable" :data="list.data" stripe v-loading="loading" header-row-class-name="head_color" tooltip-effect="dark"
              style="width: 99.8%">
            <el-table-column label="头像" min-width="80">
              <template slot-scope="scope">
                <div class="img_bor_tx">
                  <img :src="$fnc.getImgUrl(scope.row.avatar)" alt />
                </div>
              </template>
            </el-table-column>
            <el-table-column label="用户信息" min-width="160">
              <template slot-scope="scope">
                <div class="tab_div">
                  <div>
                    <span>用户昵称：</span>
                    <span>{{ scope.row.nickname || "----" }}</span>
                  </div>
                  <div>
                    <span>会员账号：</span>
                    <span>{{ scope.row.username || "---" }}</span>
                  </div>
                  <div>
                    <span>推荐人：</span>
                    <span>{{ scope.row.tid_cn || "----" }}</span>
                  </div>
                </div>
              </template>
            </el-table-column>
            <!-- <el-table-column label="添加时间" min-width="220">
              <template slot-scope="scope">
                <div class="user_table">
                  {{ scope.row.created_time | getTimeFormat }}
                </div>
              </template>
            </el-table-column> -->
          </el-table>
        </template>
      </tableComponents>
    </div>
  </DIV>
</template>

<script>
import HeadTitle from "@/components/currency/HeadTitle.vue";
export default {
  props: {
    tid: {
      type: String,
      default: "0"
    }
  },
  data () {
    return {
      list: [],
      allPage: 0,
      allNum: 0,
      pageSize: 10,
      currentPage: 1,

      show: false,
      loading: false,
      data: {
        id: "",
        boss_uid: "",
        username: "",
        nickname: ""
      }
    };
  },
  components: {
    HeadTitle
  },
  methods: {
    handleSizeChange (val) {
      var params = this.searchAll;
      params.page = "";
      params.page_size = val;
      this.getNewsAll(params);
      this.pageSize = val;
    },
    handleCurrentChange (val) {
      this.currentPage = val;
      var params = this.searchAll;
      params.page = val;
      params.page_size = this.pageSize;
      this.getNewsAll(params);
    },
    getNewsAll (data) {
      var params = {};
      data = data || {};
      params = data;
      params.id = this.$route.query.team_id;
      this.$api.getIMteam.getImTeampeople(params).then(res => {
        if (res.data.code == 200) {
          this.list = res.data.result;
        }
      });
    },
    getDetails (id) {
      var data = {};
      data["id"] = id;
      this.$api.getIMteam.getImTeamInfo(data).then(res => {
        if (res.data.code == 200) {
          this.data = res.data.result;
        }
        this.loading = false;
      });
    }
  },
  watch: {
    tid (val) {
      console.log("tid", val);
      this.getDetails(val);
    }
  },
  mounted () {
    if (this.tid == "0") {
      this.getDetails(this.$route.query.team_id);
    } else {
      this.getDetails(this.tid);
    }
  },
  beforeCreate () { },
  created () {
    this.getNewsAll();
  }
};
</script>

<style lang="less" scoped>
.info {
  margin-left: 20px;
}

.info li {
  // display: inline-block;
  float: left;
  width: 30%;
  margin: 10px 5px 5px 0;
}
.box {
  margin-left: 20px;
  margin-right: 20px;
  margin-top: 50px;
  border-bottom: 0 !important;
}
</style>
